package com.bracketbird.client;


import com.bracketbird.client.gui.pages.*;
import com.google.gwt.user.client.*;
import com.bracketbird.clientcore.appcontrol.*;
import com.bracketbird.client.url.*;
import com.bracketbird.clientcore.util.*;

import java.util.*;

/**
 * Entry point
 * classes define <code>onModuleLoad()</code>.
 */

public class Bracketbird extends com.bracketbird.clientcore.appcontrol.AppEntry {


    private GlobalKeyboardHandler gh = new GlobalKeyboardHandler();


    public void onModuleLoad() {
        super.onModuleLoad();

        loadApplication();


    }


    public void loadApplication() {
        try {
            Map<String, String> pMap = UrlUtil.getParameters();

            if (pMap.containsKey(UrlCommand.URL_COMMAND)) {
                UrlCommand.execute(pMap);
            }
            else {
                Window.enableScrolling(true);
                PageFlow.activeController = com.bracketbird.client.gui.pages.MainPageController.getInstance();
                PageFlow.show(FrontPageController.getInstance());

                UserManager.getInstance().silentLogIn();
                gh.setupSingleAppKeyboardShortcuts();
            }

            //printBackEnd();
        }

        catch (Throwable t) {
            t.printStackTrace();
            ApplicationController.getInstance().error(t, null);
        }
    }
}
